﻿@using OnlineStore.Models
@model OnlineStore.Models.Order

@{
    ViewBag.Title = "title";
    Layout = "_Layout";
}

<h2>订单详情</h2>

<h3 class="mt-4">订单号</h3>

<div class="container">

    <div class="row mt-4">
        <div class="card">
            <div class="card-body">
                <h5 class="card-title">收货人姓名：@Model.ContactInfo.Name</h5>
                <p class="card-text">收货人联系方式：@Model.ContactInfo.Phone</p>
                <address class="card-footer">收货地址：@Model.ContactInfo.Address</address>
            </div>
        </div>
    </div>

    @if (Model.State != OrderState.WaitToDeal)
    {
        <div class="row mt-4">
            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">发货人姓名：@Model.OrderDetail.ContactInfo.Name</h5>
                    <p class="card-text">发货人联系方式：@Model.OrderDetail.ContactInfo.Phone</p>
                    <address class="card-footer">发货地址：@Model.OrderDetail.ContactInfo.Address</address>
                </div>
            </div>
        </div>
    }


    <h4>购物车中的商品</h4>

    <table class="table">
        <tr>
            <th>商品名</th>
            <th>商品类别</th>
            <th>商品的价格</th>
            <th>数量</th>
        </tr>
        @foreach (var inOrder in Model.ProductInOrders)
        {
            <tr>
                <td>@inOrder.Product.Name</td>
                <td>@inOrder.Product.Type</td>
                <td>@inOrder.Product.Price</td>
                <td>@inOrder.Quantity</td>
            </tr>
        }
    </table>

    <div>
        购物车中商品的总价为： <span class="text-info">@Model.ProductInOrders.Sum(order => order.Product.Price * order.Quantity)</span>
    </div>
</div>